using System;
using System.BusinessObjects.Transactions;
using Blazing.BusinessObjects.Tagging;
using NHibernate;
using NHibernate.Criterion;

namespace Blazing.BusinessObjects.Queries
{
    public class QrySearchTaxonomys
    {
        public static ICriteria Query()
        {
            ICriteria qry = UnitOfWork.CurrentSession.CreateCriteria(typeof(Taxonomy));
            qry.AddOrder(Order.Asc("ID"));
            return qry;
        }

        public static ICriteria Query(int id)
        {
            ICriteria qry = UnitOfWork.CurrentSession.CreateCriteria(typeof(Taxonomy));
            qry.Add(Expression.Eq("ID", id));
            return qry;
        }

        public static ICriteria Query(string name)
        {
            ICriteria qry = UnitOfWork.CurrentSession.CreateCriteria(typeof(Taxonomy));
            qry.Add(Expression.Eq("Name", name));
            qry.AddOrder(Order.Asc("ID"));
            return qry;
        }
    }
}
